﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ElegxosMiFisikwnProswpwn
{
    static class Utilities
    {
        internal static bool ValidateAFM(string AFM)
        {
            long ypoloipo, sinolo;
            int i, j;

            if (AFM.Length != 9)
                return false;

            for (i = 2, j = 7, sinolo = 0; j >= 0; j--, i += i)
                sinolo += i * (AFM[j] - '0');
            ypoloipo = sinolo % 11;

            return (ypoloipo == 10) ? AFM[8] == '0' : (AFM[8] - '0') == ypoloipo;
        }
    }
}
